package com.muyan.design.singleton;

public class SingletonBetter {

    private static SingletonBetter instance;

    private SingletonBetter() {
    }

    public static SingletonBetter getInstance() {
        if (instance == null) {
            syncInit();
        }
        return instance;
    }

    private static synchronized void syncInit() {
        if (instance == null) {
            instance = new SingletonBetter();
        }
    }

    public Object readResolve() {
        return getInstance();
    }
}
